package com.hyh.shiyanshiguanli.handler;
import com.hyh.shiyanshiguanli.Expections.BaseException;
import com.hyh.shiyanshiguanli.domain.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author hyh
 * @version 1.0
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler
    public Result exceptionHandler(BaseException ex){
        log.info("异常信息：{}",ex.getMessage());
        return Result.error(ex.getMessage());
    }

}
